package com.tedu.egmybatis1damo.mapper;


import com.tedu.egmybatis1damo.pojo.Product;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProductMapper {

    @Insert("INSERT INTO product (title,price,stock) VALUES (#{title},#{price},#{stock})")
    int insertProduct(Product product);

    @Select("SELECT id ,titleprice,stock  FROM product WHERE id=#{id}")
    Product selectProductById(int id);

    @Delete("DELETE FROM product WHERE id=#{id}")
    int delecteProductById(int id);

    @Select("SELECT FROM product WHERE id=#{id}")
    List<Product> selectAllProduct();


}
